import React, { PureComponent } from 'react';
import { Table } from 'antd';

class KeymapTable extends PureComponent {
  render() {
    const { canSort } = this.props;
    const dataSource = [
      // { key: '1', name: '保存并新增', keymap: 'F12' },
      // { key: '2', name: '新增', keymap: 'Alt+N' },
      // { key: '4', name: '自动平衡', keymap: '=' },
      // { key: '5', name: '保存', keymap: 'Ctrl+S' },
      // 单元格切换：左边单元格(shift+left/shift+tab)、右边单元格(shift+right/enter)、上一行当前列单元格(shift+up)、下一行当前列单元格(shift+down)
      { key: '51', name: '自动平衡借贷方金额', keymap: '=' },
      { key: '6', name: '上一单元格', keymap: 'Shift+← 或 Shift+Tab' },
      { key: '7', name: '下一单元格', keymap: 'Shift+→ 或 Enter 或 Tab' },
      { key: '8', name: '上一行单元格', keymap: 'Shift+↑' },
      { key: '9', name: '下一行单元格', keymap: 'Shift+↓' },
      // 行操作：添加行(shift+alt+down)、插入行(shift+alt+up)、删除行(shift+delete/shift+backspace)、上移(alt+up)、下移(alt+down)
      { key: '10', name: '添加行', keymap: 'Shift+Alt+↓' },
      { key: '11', name: '插入行', keymap: 'Shift+Alt+↑' },
      { key: '12', name: '删除行', keymap: 'Shift+Delete 或 Shift+Backspace' },
    ];
    if (false !== canSort) {
      dataSource.push(
        { key: '13', name: '上移行', keymap: 'Alt+↑' },
        { key: '14', name: '下移行', keymap: 'Alt+↓' },
      );
    }

    return (
      <Table
        className={'mb8 '}
        pagination={false}
        size=''
        bordered
        columns={[
          {
            title: '功能',
            dataIndex: 'name',
            key: 'name',
            className: 'bg-gray-light',
          },
          {
            title: '快捷键',
            dataIndex: 'keymap',
            key: 'keymap',
          },
        ]}
        dataSource={dataSource}
      />
    );
  }
}

export default KeymapTable;
